<template>
  <div class="form-wrapper">
    <div class="form-header">
      <div class="title">🎉 活动安排</div>
      <el-button type="default" @click="$emit('close')">返回聊天</el-button>
    </div>

    <div class="form-body">
      <div class="field">
        <div class="label">活动日期</div>
        <el-radio-group v-model="daysOption">
          <el-radio-button :label="1">今日</el-radio-button>
          <el-radio-button :label="3">三天</el-radio-button>
          <el-radio-button :label="7">七日</el-radio-button>
        </el-radio-group>
      </div>

      <div class="tip">提交后将生成相应的活动安排建议并发送到对话。</div>
    </div>

    <div class="form-footer">
      <el-button type="primary" @click="onGenerate" :disabled="isSubmitting">查询</el-button>
      <el-button @click="$emit('close')" :disabled="isSubmitting">取消</el-button>
    </div>
  </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue'

const emit = defineEmits(['close', 'generate'])

const daysOption = ref(1)
const isSubmitting = ref(false)

const onGenerate = () => {
  if (isSubmitting.value) return
  isSubmitting.value = true
  const days = daysOption.value
  const label = days === 1 ? '今日' : days === 3 ? '三天' : '七日'
  isSubmitting.value = false
  emit('generate', { days, label })
}
</script>

<style scoped>
.form-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.title {
  font-size: 18px;
  font-weight: 700;
}

.form-body {
  flex: 1;
  padding: 16px 0;
  overflow: auto;
}

.field {
  margin-bottom: 18px;
}

.label {
  margin-bottom: 10px;
  font-weight: 600;
}

.tip {
  color: #666;
  font-size: 13px;
}

.form-footer {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
</style>
